<?php

class doctrineGenerateadminallTask extends sfBaseTask
{
  protected function configure()
  {
    $this->addArguments(array(
      new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'),
    ));

    $this->addOptions(array(
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      // add your own options here
    ));

    $this->namespace        = 'doctrine';
    $this->name             = 'generate-admin-all';
    $this->briefDescription = 'generate-admin every models once for all';
    $this->detailedDescription = <<<EOF
The [doctrine:generate-admin-all|INFO] task generate-admin every model once for all.
Call it with:

  [php symfony doctrine:generate-admin-all|INFO]
EOF;
  }

  protected function execute($arguments = array(), $options = array())
  {
    unset($arguments['task']);
    foreach (ModelNameListGenerator::generate() as $model)
    {
      $arguments['route_or_model'] = $options['module'] = $model;
      $this->runTask('doctrine:generate-admin', $arguments, $options);
    }
  }
}
